using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerSkillManager : MonoBehaviour
{
    public Skill_Dash skillDash;
    public Skill_Shard skillShard;
    public Skill_SwordThrow skillSwordThrow;
    public Skill_TimeEcho skillTimeEcho;
    public Skill_DomainExpansion skillDomainExpansion;
    public Skill_Base[] skills { get; private set; }
    private void Awake()
    {
        skillDash = GetComponentInChildren<Skill_Dash>();
        skillShard = GetComponentInChildren<Skill_Shard>();
        skillSwordThrow = GetComponentInChildren<Skill_SwordThrow>();
        skillTimeEcho = GetComponentInChildren<Skill_TimeEcho>();
        skills = GetComponentsInChildren<Skill_Base>();
        skillDomainExpansion = GetComponentInChildren<Skill_DomainExpansion>();
    }

    public Skill_Base GetSkillByType(SkillType skillType)
    {
        switch (skillType)
        {
            case SkillType.Dash: return skillDash;
            case SkillType.TimeShard: return skillShard;
            case SkillType.SwordThrow: return skillSwordThrow;
            case SkillType.TimeEcno: return skillTimeEcho;
            case SkillType.Domain: return skillDomainExpansion;
            default:
                Debug.Log($"skill type {skillType} is not implemented yet");
                return null;
        }
    }
    public void ReduceAllSkillCooldown(float cooldownReduction)
    {
        foreach (var skill in skills)
            skill.ReduceCooldownBy(cooldownReduction);
    }
}
